<template>
  <div class="p-2">
    <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
      <div class="search" v-show="showSearch">
        <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px" class="search-form">
          <!-- <el-form-item label="学生姓名" prop="studentName">
            <el-input v-model="queryParams.studentName" placeholder="请输入学生姓名" clearable style="width: 240px" @keyup.enter="handleQuery" />
          </el-form-item> -->
          <el-form-item label="时间范围" prop="belongId">
            <el-tree-select
                v-model="queryParams.belongId"
                :data="classOptions"
                :props="{ value: 'id', label: 'label', children: 'children' }"
                value-key="id"
                placeholder="请选择"
                check-strictly
                default-expand-all
                @change="timeTypeonchange"
            />
          </el-form-item>
          <el-form-item label="日期" style="width: 308px">
            <el-date-picker
              v-model="dateRangeCreateTime"
              value-format="YYYY-MM-DD HH:mm:ss"
              type="datetimerange"
              range-separator="-"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              :default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]"
            />
          </el-form-item>
          <el-form-item label="所属计划" prop="planId">
            <el-select v-model="queryParams.planId" placeholder="请选择计划" clearable>
              <el-option v-for="dict in planlist" :key="dict.planId" :label="dict.planName" :value="dict.planId" />
            </el-select>
          </el-form-item>
          <el-form-item label="所属路线" prop="routeId">
            <el-select v-model="queryParams.routeId" placeholder="请选择路线" clearable>
              <el-option v-for="dict in routeList" :key="dict.routeId" :label="dict.routeName" :value="dict.routeId" />
            </el-select>
          </el-form-item>
          <el-form-item label="分类目录" prop="catalogueId">
            <el-select v-model="queryParams.catalogueId" placeholder="请选择分类目录" clearable>
              <el-option v-for="dict in groupOptions" :key="dict.catalogueId" :label="dict.catalogueName" :value="dict.catalogueId" />
            </el-select>
          </el-form-item>
          <el-form-item label="执行情况" prop="situationResult">
            <el-select v-model="queryParams.situationResult" placeholder="请选择执行情况" clearable>
              <el-option v-for="dict in zxqkArr" :key="dict.id" :label="dict.label" :value="dict.id" />
            </el-select>
          </el-form-item>
          <el-form-item label="是否合格" prop="isPass">
            <el-select v-model="queryParams.isPass" placeholder="请选择" clearable>
              <el-option v-for="dict in isPassArr" :key="dict.id" :label="dict.label" :value="dict.id" />
            </el-select>
          </el-form-item>
          <el-form-item label="点名称" prop="spotName">
            <el-input v-model="queryParams.spotName"  placeholder="请输入名称" clearable style="width: 240px"  />
          </el-form-item>
          <el-form-item label="巡检人员" prop="staffName">
            <el-input v-model="queryParams.staffName" placeholder="请输入巡检人员" clearable style="width: 240px" />
          </el-form-item>
          <!-- <el-form-item label="识别时间" style="width: 308px">
            <el-date-picker
              v-model="dateRangeRecognizeTime"
              value-format="YYYY-MM-DD HH:mm:ss"
              type="daterange"
              range-separator="-"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              :default-time="[new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 59, 59)]"
            />
          </el-form-item> -->
          <el-form-item>
            <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
            <el-button icon="Refresh" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form>
      </div>
    </transition>

    <el-card shadow="never">
      <template #header>
        <el-row :gutter="10" class="mb8">
          <!--          <el-col :span="1.5">-->
          <!--            <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['attendance:studentRecognitionRecord:add']">新增</el-button>-->
          <!--          </el-col>-->
          <!--          <el-col :span="1.5">-->
          <!--            <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['attendance:studentRecognitionRecord:edit']">修改</el-button>-->
          <!--          </el-col>-->
          <!--          <el-col :span="1.5">-->
          <!--            <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['attendance:studentRecognitionRecord:remove']">删除</el-button>-->
          <!--          </el-col>-->
          <!--          <el-col :span="1.5">-->
          <!--            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['attendance:studentRecognitionRecord:export']">导出</el-button>-->
          <!--          </el-col>-->
          <el-col :span="1.5">
                 <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['attendance:studentRecognitionRecord:export']">导出</el-button>
              </el-col>
          <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>
      </template>

      <el-table height="calc(100vh - 360px)" v-loading="loading" :data="studentRecognitionRecordList" @selection-change="handleSelectionChange">
        <el-table-column label="编号" align="center" prop="patrolId" />
        <el-table-column label="巡检计划名称" align="center" prop="patrolPlan" />
        <el-table-column label="巡检线路名称" align="center" prop="patrolRoute"/>
        <el-table-column label="点名称" align="center" prop="spotName" />
        <el-table-column label="点编号" align="center" prop="spotNumber" />
        <el-table-column label="分类目录" align="center" prop="catalogueName"/>
        <el-table-column label="巡检人员" align="center" prop="patrolUserName" />
        <el-table-column label="巡检时间" align="center" prop="patrolTime" />
        <el-table-column label="执行情况" align="center" prop="studentStatus">
          <template #default="scope">
            <div v-if="scope.row.situationResult=='0'">
              待执行
            </div>
            <div v-if="scope.row.situationResult=='1'">
              按时完成
            </div>
            <div v-if="scope.row.situationResult=='2'">
              提前完成
            </div>
            <div v-if="scope.row.situationResult=='3'">
              延时完成
            </div>
          </template>
        </el-table-column>
        <el-table-column label="是否合格" align="center" prop="studentName">
          <template #default="scope">
            <div v-if="scope.row.isPass=='0'">
              合格
            </div>
            <div v-if="scope.row.isPass=='1'">
              不合格
            </div>
          </template>
        </el-table-column>
        <el-table-column label="评分" align="center" prop="score" />
        <el-table-column label="不合格项目" align="center" prop="noPassProject"/>
        <el-table-column label="备注说明" align="center" prop="remark" />
        <el-table-column label="任务编号" align="center" prop="taskId">
          <template #default="scope">
            <div @click="looktask(scope.row.taskId)" style="color: blue;text-decoration: underline;cursor: pointer;">
              {{ scope.row.taskId}}
            </div>
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="total>0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
    </el-card>
    <!-- 添加或修改学生识别记录对话框 -->
    <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
      <el-form ref="studentRecognitionRecordFormRef" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="学生id" prop="studentId">
          <el-input v-model="form.studentId" placeholder="请输入学生id" />
        </el-form-item>
        <el-form-item label="学生姓名" prop="studentName">
          <el-input v-model="form.studentName" placeholder="请输入学生姓名" />
        </el-form-item>
        <el-form-item label="性别" prop="gender">
          <el-select v-model="form.gender" placeholder="请选择性别">
            <el-option v-for="dict in student_sex" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="班级id" prop="classId">
          <el-input v-model="form.classId" placeholder="请输入班级id" />
        </el-form-item>
        <el-form-item label="班级名称" prop="className">
          <el-input v-model="form.className" placeholder="请输入班级名称" />
        </el-form-item>
        <el-form-item label="级别" prop="gradeLevel">
          <el-select v-model="form.gradeLevel" placeholder="请选择级别">
            <el-option v-for="dict in school_grade_level" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="学生状态" prop="studentStatus">
          <el-select v-model="form.studentStatus" placeholder="请选择学生状态">
            <el-option v-for="dict in student_school_status" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="识别时间" prop="recognizeTime">
          <el-date-picker clearable v-model="form.recognizeTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择识别时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="设备类型" prop="deviceType">
          <el-select v-model="form.deviceType" placeholder="请选择设备类型">
            <el-option v-for="dict in device_type" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="设备编码" prop="deviceCode">
          <el-input v-model="form.deviceCode" placeholder="请输入设备编码" />
        </el-form-item>
        <el-form-item label="设备名称" prop="deviceName">
          <el-input v-model="form.deviceName" placeholder="请输入设备名称" />
        </el-form-item>
        <el-form-item label="图片路径" prop="facePic">
          <el-input v-model="form.facePic" placeholder="请输入图片路径" />
        </el-form-item>
        <el-form-item label="抓拍图" prop="snapshotPic">
          <el-input v-model="form.snapshotPic" placeholder="请输入抓拍图" />
        </el-form-item>
        <el-form-item label="比对分值" prop="comparisonScore">
          <el-input v-model="form.comparisonScore" placeholder="请输入比对分值" />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>
    <!-- 任务单 -->
    <el-dialog v-model="taskDialog.visible" title="巡检任务单详情" width="50vw" @close="closeDialog">
      <el-descriptions title="" :column="1" border>
        <el-descriptions-item label="任务标题:">{{taskDetail.taskName}}</el-descriptions-item>
      </el-descriptions>
      <el-descriptions title="" :column="1" border>
        <el-descriptions-item label="发起人:">{{taskDetail.createBy }}</el-descriptions-item>
        <el-descriptions-item label="执行人:">{{taskDetail.executor}}</el-descriptions-item>
        <el-descriptions-item label="状态:">{{taskDetail.taskStatus}}</el-descriptions-item>
        <el-descriptions-item label="关联记录:">
          <div @click="lookxj(taskDetail.patrolId)" style="color: blue;text-decoration: underline;cursor: pointer;">查看</div>
        </el-descriptions-item>
        <el-descriptions-item label="要求完成时间:">{{taskDetail.askCompleteTime}}</el-descriptions-item>
        <el-descriptions-item label="任务内容:">{{taskDetail.remark}}</el-descriptions-item>
        <el-descriptions-item label="任务图片：">
          <!-- <div v-for="item in taskDetail.taskImgs">
            <img class="item-img" style="width: 150px;" :src="item.taskImgAddress" alt="" />
          </div> -->
          <el-image 
      v-for="item in taskDetail.taskImgs"
    style="width: 100px; height: 100px;margin-right: 20px;"
    :src="item.taskImgAddress" 
   >
  </el-image>
        </el-descriptions-item>
        <!-- <el-descriptions-item label="检查项目：">
          <el-descriptions title="" :column="2" border>
            <el-descriptions-item label="项目名称">检查结果</el-descriptions-item>
            <el-descriptions-item label="是否合格">评分</el-descriptions-item>
            <el-descriptions-item label="机房温度">23分</el-descriptions-item>
            <el-descriptions-item label="合格">10</el-descriptions-item>
            <el-descriptions-item label="灭火器">合格</el-descriptions-item>
            <el-descriptions-item label="合格">10</el-descriptions-item>
          </el-descriptions>
        </el-descriptions-item> -->
      </el-descriptions>
      <!-- <el-descriptions title="" :column="1" border>
        <el-descriptions-item label="现场照片">
          <img class="item-img" style="width: 150px;" src="@/assets/images/bigScreen-bg1.png" alt="" />
          <img class="item-img" style="width: 150px;" src="@/assets/images/bigScreen-bg1.png" alt="" />
          <img class="item-img" style="width: 150px;" src="@/assets/images/bigScreen-bg1.png" alt="" />
        </el-descriptions-item>
        <el-descriptions-item label="备注"> 12213121</el-descriptions-item>
      </el-descriptions> -->
      <template #footer>
        <div class="dialog-footer">1</div>
      </template>
    </el-dialog>
    <check :xjdataArr="xjData[0]" :visible="checkVisiable" @closeDialog="closeAddCheckDialog" />
  </div>
</template>

<script setup name="StudentRecognitionRecord" lang="ts">
import {
  listStudentRecognitionRecord,
  getStudentRecognitionRecord,
  delStudentRecognitionRecord,
  addStudentRecognitionRecord,
  updateStudentRecognitionRecord
} from '@/api/attendance/recognize/student';
import { StudentRecognitionRecordVO, StudentRecognitionRecordQuery, StudentRecognitionRecordForm } from '@/api/attendance/recognize/student/types';
import { getRecordC2Vo, patrolRecordList, searchinspectItemsCatalogue, searchspecttaskdetail } from '@/api/inspection';
import { ApiGetInspectionplanSettingList } from '@/api/inspection/inspectionplanSetting';
import { ApiGetInspectionRouteList } from '@/api/inspection/inspectionroute';
import { classTree, listClassInfo } from '@/api/office/class';
import check from '@/views/Inspection/items/situation/childrens/check.vue'
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { school_grade_level, device_type, student_sex, student_school_status } = toRefs<any>(
  proxy?.useDict('school_grade_level', 'device_type', 'student_sex', 'student_school_status')
);
const checkVisiable = ref(false);
const xjData=ref<any[]>([]);
  const closeAddCheckDialog = () => {
  checkVisiable.value = false;
};
const studentRecognitionRecordList = ref<StudentRecognitionRecordVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const dateRangeRecognizeTime = ref<[DateModelType, DateModelType]>(['', '']);
// 今天、昨天、本月、上月、本周、上周、最近7天、最近30天、最近12月、今年、去年、全部
const classOptions = ref<any[]>([
  {
    id:"1",
    label: "今天"
  },
  {
    id:"2",
    label: "昨天"
  },
  {
    id:"3",
    label: "本月"
  },
  {
    id:"4",
    label: "上月"
  },
  {
    id:"5",
    label: "本周"
  },
  {
    id:"6",
    label: "上周"
  },
  {
    id:"7",
    label: "最近7天"
  },
  {
    id:"8",
    label: "最近30天"
  },
  {
    id:"9",
    label: "最近12月"
  },
  {
    id:"10",
    label: "今年"
  },
  {
    id:"11",
    label: "去年"
  },
  {
    id:"12",
    label: "全部"
  },
]);
const dateRangeCreateTime = ref<[DateModelType, DateModelType]>(['', '']);
const timeTypeonchange=(e:any,c:any)=>{
  let startTime = new Date();
  let endTime = new Date();
  startTime.setHours(0, 0, 0, 0); 
  if(queryParams.value.belongId=="1"){
    startTime.setDate(startTime.getDate())
  }if(queryParams.value.belongId=="2"){
    startTime.setDate(startTime.getDate() - 1);
  }if(queryParams.value.belongId=="3"){
    startTime.setMonth( startTime.getMonth());
    startTime.setDate(1)
  }if(queryParams.value.belongId=="4"){
    startTime.setMonth( startTime.getMonth()-1);
    startTime.setDate(1);
    endTime.setMonth(endTime.getMonth());
    endTime.setDate(0)
    endTime.setHours(23, 59, 59, 999);
  }if(queryParams.value.belongId=="5"){
    let day=startTime.getDay()
    startTime.setDate(startTime.getDate()-day+(day === 0 ? -6 : 1));
  }if(queryParams.value.belongId=="6"){
    let day=startTime.getDay();
    startTime.setDate(startTime.getDate()-day-7+(day === 0 ? -6 : 1));
    endTime.setDate(endTime.getDate()-day-1+(day === 0 ? -6 : 1));
    endTime.setHours(23, 59, 59, 999);
  }if(queryParams.value.belongId=="7"){
    startTime.setDate(startTime.getDate() - 7);
  }if(queryParams.value.belongId=="8"){
    startTime.setDate(startTime.getDate() - 30);
  }if(queryParams.value.belongId=="9"){
    startTime.setFullYear(startTime.getFullYear()-1);
  }if(queryParams.value.belongId=="10"){
    startTime.setMonth(0);
    startTime.setDate(1)
  }if(queryParams.value.belongId=="11"){
    startTime.setFullYear(startTime.getFullYear()-1);
    startTime.setMonth(0);
    startTime.setDate(1);
    endTime.setFullYear(endTime.getFullYear()-1);
    endTime.setMonth(11);
    endTime.setDate(31);
    endTime.setHours(23, 59, 59, 999);
  }else{
    startTime.setDate(startTime.getDate())
  }
  console.log("ddddddd,",dateRangeCreateTime.value)
  dateRangeCreateTime.value = [proxy?.parseTime(startTime, '{y}-{m}-{d} {h}:{i}:{s}'), proxy?.parseTime(endTime, '{y}-{m}-{d} {h}:{i}:{s}')];

}
//任务单详情
const taskDetail=ref<any>({})
const looktask=async(row?:any)=>{
  loading.value = true;
  const res:any=await searchspecttaskdetail(row);
  taskDetail.value=res?.data
  loading.value = false;
  taskDialog.visible=true
}
const lookxj=async(row?:any)=>{
  checkVisiable.value = true;
   
  const res=await getRecordC2Vo(row);
  xjData.value=res.data
}
const planlist=ref<any[]>([])
/** 查询学生识别记录列表 */
const getplanList = async () => {
  loading.value = true;
  const res = await ApiGetInspectionplanSettingList();
  planlist.value = res.rows;
  total.value = res.total;
  loading.value = false;
};
//路线列表
const routeList = ref<Array<string | number>>([]);
const groupOptions = ref<any[]>([]);
/** 查询路线列表 */
const getrouteList = async () => {
  loading.value = true;
  const res = await ApiGetInspectionRouteList();
  routeList.value = res.rows;
  total.value = res.total;
  loading.value = false;
};
/** 查询分类目录 */
const getGroupTree = async () => {
  const res = await searchinspectItemsCatalogue();
  groupOptions.value = res.data;
};
const queryFormRef = ref<ElFormInstance>();
const studentRecognitionRecordFormRef = ref<ElFormInstance>();

const dialog = reactive<DialogOption>({
  visible: false,
  title: ''
});
//巡检任务弹窗
const taskDialog = reactive<DialogOption>({
  visible: false,
  title: ''
});
const initFormData: StudentRecognitionRecordForm = {
  id: undefined,
  studentId: undefined,
  studentName: undefined,
  gender: undefined,
  classId: undefined,
  className: undefined,
  gradeLevel: undefined,
  studentStatus: undefined,
  recognizeTime: undefined,
  deviceType: undefined,
  deviceCode: undefined,
  deviceName: undefined,
  facePic: undefined,
  snapshotPic: undefined,
  comparisonScore: undefined
};
const data = reactive<any>({
  form: { ...initFormData },
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    studentName: undefined,
    classId: undefined,
    gradeLevel: undefined,
    studentStatus: undefined,
    deviceType: undefined,
    params: {
      recognizeTime: undefined
    }
  },
  rules: {
    id: [{ required: true, message: '不能为空', trigger: 'blur' }],
    studentId: [{ required: true, message: '学生id不能为空', trigger: 'blur' }],
    gender: [{ required: true, message: '性别不能为空', trigger: 'change' }],
    classId: [{ required: true, message: '班级id不能为空', trigger: 'blur' }],
    gradeLevel: [{ required: true, message: '级别不能为空', trigger: 'change' }],
    studentStatus: [{ required: true, message: '学生状态不能为空', trigger: 'change' }],
    recognizeTime: [{ required: true, message: '识别时间不能为空', trigger: 'blur' }],
    deviceType: [{ required: true, message: '设备类型不能为空', trigger: 'change' }],
    deviceCode: [{ required: true, message: '设备编码不能为空', trigger: 'blur' }],
    deviceName: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
    facePic: [{ required: true, message: '图片路径不能为空', trigger: 'blur' }],
    snapshotPic: [{ required: true, message: '抓拍图不能为空', trigger: 'blur' }],
    comparisonScore: [{ required: true, message: '比对分值不能为空', trigger: 'blur' }]
  }
});

const { queryParams, form, rules } = toRefs(data);

const getClassTree = async () => {
  // const res = await classTree();
  // classOptions.value = res.data;
};
// 0待执行 1按时完成 2提交完成 3延时完成
const zxqkArr=ref<any[]>([
  {
    id:"0",
    label: "待执行"
  },
  {
    id:"1",
    label: "按时完成"
  },
  {
    id:"2",
    label: "提交完成"
  },
  {
    id:"3",
    label: "延时完成"
  },
 
])
//合格
const isPassArr =ref<any[]>([
  {
    id:"0",
    label: "合格"
  },
  {
    id:"1",
    label: "不合格"
  },
])
/** 查询学生识别记录列表 */
const getList = async () => {
  loading.value = true;
  queryParams.value.params = {};
  queryParams.value.beginPatrolTime=dateRangeCreateTime.value[0];
  queryParams.value.endPatrolTime=dateRangeCreateTime.value[1];
  const res = await patrolRecordList(queryParams.value);
  studentRecognitionRecordList.value = res.rows;
  total.value = res.total;
  loading.value = false;
};

/** 取消按钮 */
const cancel = () => {
  reset();
  dialog.visible = false;
};

/** 表单重置 */
const reset = () => {
  form.value = { ...initFormData };
  studentRecognitionRecordFormRef.value?.resetFields();
};

/** 搜索按钮操作 */
const handleQuery = () => {
  queryParams.value.pageNum = 1;
  getList();
};

/** 重置按钮操作 */
const resetQuery = () => {
  dateRangeRecognizeTime.value = ['', ''];
  queryFormRef.value?.resetFields();
  handleQuery();
};

/** 多选框选中数据 */
const handleSelectionChange = (selection: StudentRecognitionRecordVO[]) => {
  ids.value = selection.map((item) => item.id);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
};

/** 新增按钮操作 */
const handleAdd = () => {
  reset();
  dialog.visible = true;
  dialog.title = '添加学生识别记录';
};

/** 修改按钮操作 */
const handleUpdate = async (row?: StudentRecognitionRecordVO) => {
  reset();
  const _id = row?.id || ids.value[0];
  const res = await getStudentRecognitionRecord(_id);
  Object.assign(form.value, res.data);
  dialog.visible = true;
  dialog.title = '修改学生识别记录';
};

/** 提交按钮 */
const submitForm = () => {
  studentRecognitionRecordFormRef.value?.validate(async (valid: boolean) => {
    if (valid) {
      buttonLoading.value = true;
      if (form.value.id) {
        await updateStudentRecognitionRecord(form.value).finally(() => (buttonLoading.value = false));
      } else {
        await addStudentRecognitionRecord(form.value).finally(() => (buttonLoading.value = false));
      }
      proxy?.$modal.msgSuccess('修改成功');
      dialog.visible = false;
      await getList();
    }
  });
};

/** 删除按钮操作 */
const handleDelete = async (row?: StudentRecognitionRecordVO) => {
  const _ids = row?.id || ids.value;
  await proxy?.$modal.confirm('是否确认删除学生识别记录编号为"' + _ids + '"的数据项？').finally(() => (loading.value = false));
  await delStudentRecognitionRecord(_ids);
  proxy?.$modal.msgSuccess('删除成功');
  await getList();
};

/** 导出按钮操作 */
const handleExport = () => {
  proxy?.download(
    'inspection/patrolRecord/export',
    {
      ...queryParams.value
    },
    `patrolRecord_${new Date().getTime()}.xlsx`
  );
};

onMounted(() => {
  let startTime = new Date();
  let endTime = new Date();
  startTime.setHours(0, 0, 0, 0); 
  startTime.setDate(startTime.getDate())
  dateRangeCreateTime.value = [proxy?.parseTime(startTime, '{y}-{m}-{d} {h}:{i}:{s}'), proxy?.parseTime(endTime, '{y}-{m}-{d} {h}:{i}:{s}')];
  getClassTree();
  getList();
  getrouteList();
  getGroupTree();
  getplanList()
});
</script>
